package com.cy.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cy.entity.JsonResult;
import com.cy.entity.Type;
import com.cy.service.TypeService;

@RestController
public class TypeController {
	@Autowired
	private TypeService service;
	
	@RequestMapping("findAllType")
	public JsonResult findAllType() {
		List<Type> list = service.findAllType();
		return new JsonResult<>(list); 
	}
	
	@RequestMapping("findTypeById")
	public JsonResult findTypeById(Integer id) {
		Type type = service.findTypeById(id);
		return new JsonResult(type);
	}
}
